vcUnitGroup

Unit group represents a group of units that apply to the same quantity and belong to the same unit family, thereby allowing you to create and delete unit objects.

See in: Overview

Module: vcCore

Parent: vcObject

Children -

Referenced by: vcQuantity.AvailableGroups, vcQuantity.CurrentGroup, vcQuantity.EffectiveGroup, vcUnitFamily.Groups, ... (see more)
vcQuantity.AvailableGroups
vcQuantity.CurrentGroup
vcQuantity.EffectiveGroup
vcUnitFamily.Groups
vcUnitManager.UnitGroups
vcUnitManager.createUnitGroup()
vcUnitManager.findUnitGroup()

Properties

Learn how to use properties here. The properties are also inherited from the parent class.

NameTypeAccessDescription
IsBuiltInBooleanRGets a value which defines if the unit group is a built-in group.
NameStringRWGets or sets unit group name.

Exceptions:
ValueError: When given name is empty or not unique.
QuantityvcQuantityRWGets the quantity referencing unit group.
UnitsvcList[vcUnit]RGets a list of all units in unit group.

See Unit strings

Methods

Learn how to use methods here. The methods are also inherited from the parent class.

NameReturn TypeParametersDescription
createUnitvcUnitString name,
String suffix
Adds a new unit of a given name and suffix to unit group.
See more
Parameters:
name (String): Unit's name.
suffix (String): Unit's suffix.

Exceptions:
ValueError: When current unit group is built-in.
ValueError: When both name and suffix are not unique or either of them is empty.

Returns:
vcUnit: The newly created unit.
deleteNoneNoneDeletes the unit group.

Exceptions:
RuntimeError: When deleting a built-in unit group object.
findUnitvcUnitString nameFinds a unit in unit group by its name.
See more
Parameters:
name (String): Unit's name.

Returns:
vcUnit: The found unit or None if no unit with the given name exists.
getUnitWithMagnitudevcUnitReal magnitudeReturns a unit in unit group that best matches given magnitude.
See more
Parameters:
magnitude (Real): Magnitude

Exceptions:
ValueError: When given magnitude is less or equal to zero.

Returns:
vcUnit: a unit that best matches given magnitude.